package bio;

import java.io.*;
import java.net.Socket;

public class BIOClient {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("localhost", 8080);
        PrintWriter printWriter = new PrintWriter(socket.getOutputStream());
        printWriter.println("你好呀");
        printWriter.flush();
        socket.shutdownOutput();

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String temp = null;
        String info = "";
        while ((temp = bufferedReader.readLine()) != null) {
            info += temp;
        }
        System.out.println("收到服务端的回复：" + info);
        bufferedReader.close();
        printWriter.close();
        socket.close();
    }
}
